<?php
	namespace App\Services\Push;

use App\Constants\AppMsgType;

	// app消息类名转换
	class MsgTypeConvert{
		static public function intToString($type_int){
			$type = 'system';
			switch ($type_int) {
				case AppMsgType::SYSTEM:
					$type = 'system';
					break;
				case AppMsgType::IDENTITY:
					$type = 'identity';
					break;
				case AppMsgType::ORDER:
					$type = 'order';
					break;
				case AppMsgType::QUOTA:
					$type = 'quota';
					break;
				case AppMsgType::BILL:
					$type = 'bill';
					break;
				case AppMsgType::PAYMENT:
					$type = 'payment';
					break;
				case AppMsgType::MOBILE:
					$type = 'mobile';
					break;
				case AppMsgType::ACTIVITY:
					$type = 'activity';
					break;
				default:
					$type = 'system';
					break;
			};
			return $type;
		}


		static public function stringToInt($type_string){
			$type_string = strtolower($type_string);
			$type = AppMsgType::SYSTEM;
			switch ($type_string) {
				case 'system':
					$type = AppMsgType::SYSTEM;
					break;
				case 'identity':
					$type = AppMsgType::IDENTITY;
					break;
				case 'order':
					$type = AppMsgType::ORDER;
					break;
				case 'quota':
					$type = AppMsgType::QUOTA;
					break;
				case 'bill':
					$type = AppMsgType::BILL;
					break;
				case 'payment':
					$type = AppMsgType::PAYMENT;
					break;
				case 'mobile':
					$type = AppMsgType::MOBILE;
					break;
				case 'activity':
					$type = AppMsgType::ACTIVITY;
					break;
				default:
					$type = AppMsgType::SYSTEM;
					break;
			};
			return $type;
		}
	}

